﻿/**
 * 
 * @file MaterialPlasticWidget.h
 * @brief 塑性材料界面接口声明
 * @author BaGuijun (baguijun@163.com)
 * @date 2024-04-22
 * 
 */
#ifndef MaterialPlasticWidget_H
#define MaterialPlasticWidget_H

#include "MaterialWidgetBase.h"
#include "FITK_Interface/FITKInterfaceStructural/FITKAbaMaterialBehavior.h"

namespace Ui{
    class MaterialPlasticWidget;
}

namespace Interface{
    class FITKAbaMaterialPlastic;
}

namespace GUI
{
    /**
     * @brief 塑性材料接口声明
     * @author BaGuijun (baguijun@163.com)
     * @date 2024-04-22
     */
    class MaterialPlasticWidget : public MaterialWidgetBase
    {
        Q_OBJECT;
    public:
        /**
         * @brief Construct a new Mat Item Plastic Form object
         * @param[i]  item           塑性材料对象
         * @param[i]  parent         父对象
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        explicit MaterialPlasticWidget(EventOper::ParaWidgetInterfaceOperator * oper,Interface::FITKAbaMaterialPlastic* item, QWidget* parent = nullptr);
        /**
         * @brief Destroy the Mat Item Plastic Form object
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        ~MaterialPlasticWidget();
        /**
         * @brief 数据检查
         * @return true 成功
         * @return false 失败
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-06-12
         */
        bool checkValue() override;
        /**
         * @brief 数据存储
         * @return true 成功
         * @return false 失败
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-06-12
         */
        bool saveValue() override;
    private slots:
        ;
        /**
         * @brief 坚固类型点击事件
         * @param[i]  index          类型索引
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-06-20
         */
        void on_comboBox_Hardening_activated(int index);
        /**
         * @brief 速度参数按钮点击事件
         * @param[i]  checked        是否点击
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-06-20
         */
        void on_checkBox_Rate_clicked(bool checked);
        /**
         * @brief 温度参数按钮点击事件
         * @param[i]  checked        是否点击
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-06-20
         */
        void on_checkBox_Temp_clicked(bool checked);
    private:
        /**
         * @brief 初始化ui
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-06-20
         */
        void initUi();
        /**
         * @brief 显示子模块数据
         * @param[i]  type           模块类型
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-06-20
         */
        void showValue(Interface::FITKAbaMaterialBehaviorEnum::FITKAbaMaterialPlasticType type);
        /**
         * @brief 存储子模块数据
         * @param[i]  type           模块类型
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-06-20
         */
        void saveValue(Interface::FITKAbaMaterialBehaviorEnum::FITKAbaMaterialPlasticType type);
        /**
         * @brief 修改材料坚固类型及相关UI更新
         * @param[i]  type           坚固类型
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-06-20
         */
        void changeMaterialHardeningType(Interface::FITKAbaMaterialBehaviorEnum::FITKAbaMaterialPlasticType type);
        /**
         * @brief 修改材料温度按钮及相关ui更新
         * @param[i]  type           类型
         * @param[i]  isTemp         是否使用温度
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-06-20
         */
        void changeMaterialTemp(Interface::FITKAbaMaterialBehaviorEnum::FITKAbaMaterialPlasticType type, bool isTemp);
        /**
         * @brief 修改速度按钮及相关ui更新
         * @param[i]  type           类型
         * @param[i]  isRate         是否使用温度
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-06-20
         */
        void changeMaterialRate(Interface::FITKAbaMaterialBehaviorEnum::FITKAbaMaterialPlasticType type, bool isRate);

        //提取单位
        QString extractNumberPart(const QString &text);
    private:
        /**
         * @brief ui对象
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        Ui::MaterialPlasticWidget*   _ui = nullptr;
        /**
         * @brief 塑性材料对象
         * @author BaGuijun (baguijun@163.com)
         * @date 2024-04-22
         */
        Interface::FITKAbaMaterialPlastic* _materialItem = nullptr;
    };
}  // namespace GUI

#endif  // MaterialPlasticWidget_H
